home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_pow_blastech_m.cog < prev    next >
Text File  |  1998-02-25  |  4KB  |  138 lines

  1. # Jedi Knight Missions Cog Script
  2. #
  3. # POW_BLASTECH_M.COG
  4. #
  5. # POWERUP Script - Blastech Pistol pickup
  6. #
  7. # [YB & CYW] + [RF]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       powerup                          local
  15. thing       player                           local
  16. int         bin=12                            local
  17. int         ammobin=11                       local
  18. sound       pickupsnd=thrmlpu2.wav           local
  19. sound       respawnsnd=Activate01.wav        local
  20. flex        amount                           local
  21.  
  22. int         bin_contents=0                   local
  23. int         autopickup=0                     local
  24. int         autoselect_weapon=-1             local
  25.  
  26. message     touched
  27. message     taken
  28. message     respawn
  29.  
  30. end
  31.  
  32. # ========================================================================================
  33.  
  34. code
  35.  
  36. touched:
  37.    player = GetSourceRef();
  38.  
  39.    if (GetThingType(player) == 10)  // Can only be taken by players.
  40.    {
  41.       if(IsMulti() || (GetInv(player, GetWeaponBin(bin)) == 0) || (GetInv(player, ammobin) < GetInvMax(player, ammobin)))
  42.       {
  43.          TakeItem(GetSenderRef(), -1);
  44.          call taken;
  45.       }
  46.    }
  47.    Return;
  48.  
  49. # ........................................................................................
  50.  
  51. taken:
  52.    player = GetSourceRef();
  53.    powerup = GetSenderRef();
  54.  
  55.    // Do effects.
  56.    PlaySoundLocal(pickupsnd, 1, 0, 0);
  57.    AddDynamicTint(player, 0.0, 0.0, 0.2);
  58.  
  59.    if(GetInv(player, GetWeaponBin(bin)) == 0)
  60.    {
  61.       // Pickup gun and ammo.
  62.       // Print("Bryar Pistol");
  63.       jkPrintUNIString(player, GetWeaponBin(bin));
  64.  
  65.       ChangeInv(player, GetWeaponBin(bin), 1.0);
  66.  
  67.       // store the old bin contents
  68.       bin_contents = GetInv(player, ammobin);
  69.       ChangeInv(player, ammobin, 10.0);
  70.  
  71.       // Check for Auto Pickup
  72.       autopickup = GetAutoPickup();
  73.       if(autopickup & 1)
  74.       {
  75.          if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, GetWeaponBin(bin), 0))))
  76.          {
  77.             if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  78.             {
  79.                SelectWeapon(player, GetWeaponBin(bin));
  80.                Return;
  81.             }
  82.          }
  83.       }
  84.  
  85.       // Check for Auto Reload
  86.       if(GetAutoReload() & 1)
  87.       {
  88.          if(!bin_contents)
  89.          {
  90.             if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  91.             {
  92.                // Try to autoselect and see if the best weapon is an energy cell weapon
  93.                autoselect_weapon = AutoSelectWeapon(player, 2);
  94.                if((autoselect_weapon == 2) || (autoselect_weapon == 12) || (autoselect_weapon == 3) || (autoselect_weapon == 13))
  95.                   SelectWeapon(player, autoselect_weapon);
  96.             }
  97.          }
  98.       }
  99.    }
  100.    else
  101.    if(GetInv(player, ammobin) < GetInvMax(player, ammobin))
  102.    {
  103.       // Pickup ammo only.
  104.       // Print("Energy Cells");
  105.       jkPrintUNIString(player, ammobin);
  106.  
  107.       // store the old bin contents
  108.       bin_contents = GetInv(player, ammobin);
  109.  
  110.       ChangeInv(player, ammobin, 10.0);
  111.  
  112.       // Check for Auto Reload
  113.       if(GetAutoReload() & 1)
  114.       {
  115.          if(!bin_contents)
  116.          {
  117.             if(!((GetAutoReload() & 2) && (GetCurWeapon(player) == jkGetMultiParam(1))))
  118.             {
  119.             // Try to autoselect and see if the best weapon is an energy cell weapon
  120.             autoselect_weapon = AutoSelectWeapon(player, 2);
  121.             if((autoselect_weapon == 2) || (autoselect_weapon == 12) || (autoselect_weapon == 3) || (autoselect_weapon == 13))
  122.                SelectWeapon(player, autoselect_weapon);
  123.             }
  124.          }
  125.       }
  126.    }
  127.  
  128.    Return;
  129.  
  130. # ........................................................................................
  131.  
  132. respawn:
  133.    PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
  134.  
  135.    Return;
  136.  
  137. end
  138.